var e = require;
var t = module;
var o = exports;
var n,
    i = o,
    a =
        ((n = function (e, t) {
            return (n =
                Object.setPrototypeOf ||
                ({__proto__: []} instanceof Array &&
                    function (e, t) {
                        e.__proto__ = t;
                    }) ||
                function (e, t) {
                    for (var o in t) t.hasOwnProperty(o) && (e[o] = t[o]);
                })(e, t);
        }),
        function (e, t) {
            function o() {
                this.constructor = e;
            }
            n(e, t), (e.prototype = null === t ? Object.create(t) : ((o.prototype = t.prototype), new o()));
        }),
    r = function (e, t, o, n) {
        var i,
            a = arguments.length,
            r = a < 3 ? t : null === n ? (n = Object.getOwnPropertyDescriptor(t, o)) : n;
        if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(e, t, o, n);
        else
            for (var s = e.length - 1; s >= 0; s--)
                (i = e[s]) && (r = (a < 3 ? i(r) : a > 3 ? i(t, o, r) : i(t, o)) || r);
        return a > 3 && r && Object.defineProperty(t, o, r), r;
    };
Object.defineProperty(i, "__esModule", {value: !0});
var s = e("GameData"),
    c = e("SkinLevelData"),
    l = cc._decorator,
    d = l.ccclass,
    u =
        (l.property,
        window.wx,
        (function (e) {
            function t() {
                var t = (null !== e && e.apply(this, arguments)) || this;
                return (
                    (t.skinChineseName = ""),
                    (t.data = null),
                    (t.name_label = null),
                    (t.click_btn = null),
                    (t.isLock = !0),
                    t
                );
            }
            return (
                a(t, e),
                (t.prototype.init = function () {
                    (this.name_label = this.node.children[1].getComponent(cc.Label)),
                        (this.click_btn = this.node.children[2].getComponent(cc.Button)),
                        this.click_btn.node.on(game.EngineEventType.NodeEvent.click, this.onClick_btn_click, this);
                    for (var e = c.SkinLevelData.instance.skinList, t = 0; t < e.length; t++) {
                        var o = e[t];
                        if (o.chinese == this.skinChineseName) {
                            this.data = o;
                            break;
                        }
                    }
                    (this.name_label.string = this.data.chinese), (this.isLock = this.data.isLock);
                }),
                (t.prototype.onClick_btn_click = function () {
                    if ((game.AudioManager.playBtnEffect(), this.isLock))
                        game.UIManager.instance.showToast("已拥有"),
                            (s.default.instance.UserSkin = this.data.index),
                            this.node.dispatchEvent(new cc.Event.EventCustom("btn_play", !0));
                    else {
                        var e = this;
                        ad.adInterface.showRewardedVideo(null, null, function () {
                            game.UIManager.instance.showToast("已试用"),
                                (s.default.instance.OldUserSkin = s.default.instance.UserSkin),
                                (s.default.instance.UserSkin = e.data.index),
                                e.node.dispatchEvent(new cc.Event.EventCustom("btn_play", !0));
                        });
                    }
                }),
                (t.prototype.onDisable = function () {
                    this.click_btn.node.off(game.EngineEventType.NodeEvent.click, this.onClick_btn_click, this);
                }),
                r([d], t)
            );
        })(cc.Component));
i.default = u;
